<template>
	<view class="content">
		<!-- <view class="nav" :class="{show_bg:is_show_bg}"> -->
		<!-- <view class="nav">
			<i class='iconfont iconfanhui funhui-css' @click="black"></i>
			<text>测评结果</text>
			<view></view>
		</view> -->
		<view class="head" style="background-image: url('../../static/image/intelligence-test-result_bg.png');">
			<image class="chu_bg" src="../../static/image/intelligence-test-head_chu.png" mode=""></image>
		</view>
		<view class="group">
			<image class="chu_yy" src="../../static/image/intelligence-test-yinying.png"></image>
			<view class="head_img">
				<view>
					<view class="view_img">
						<image class="touxiang" :src="imgurl"></image>
					</view>
					<view class="name">{{name}}</view>
				</view>
			</view>
			<view class="xinxin">
				<uni-rate :readonly="true" :value="nums" v-if="nums"></uni-rate>
			</view>
			<view class="title">
				<image class="title_img" src="../../static/image/intelligence-test-left.png"></image>
				<text>结论与建议</text>
				<image class="title_img" src="../../static/image/intelligence-test-right.png"></image>
			</view>
			<view class="group_text">
				{{datas.conclusion}}
			</view>
			<navigator url="details" hover-class="none" class="btn_ck">查看详情</navigator>
		</view>
		<navigator open-type="redirect" url="studycp?type=1" class="btn_cx">重新测试</navigator>
		<navigator open-type="navigateBack" class="btn_sr">返回首页</navigator>
	</view>
</template>

<script>
	import uniRate from '../../components/uni-rate/uni-rate.vue'

	var _this;
	export default {

		data() {
			_this = this;
			return {
				is_show_bg: false,
				datas: '',
				nums: '',
				imgurl: '',
				name: '',
				from:''
			}
		},
		onReady: function() {

		},
		created: function() {

		},
		onLoad: function(e) {
			this.from=e.from;
			// console.log('adfada')
		},
		onBackPress(options) {
			if (options.from === "backbutton") {
			if(this.from=='1'){
				uni.navigateBack({
					delta:1
				});
			}else{
				uni.reLaunch({
					url: '../index/index'
				});
			}
				return false;
			}
		},
		// onPageScroll: function(e) {
		// 	if (e.scrollTop == 0) {
		// 		this.is_show_bg = false;
		// 	} else {
		// 		this.is_show_bg = true;
		// 	}
		// 
		// },
		onShow: function() {
			var token = uni.getStorageSync('token');
			_this.$zapi.apiPost('user/parevalua.users/userEvaluatingLogBase', {
				'k_token': token
			}).then(res => {
				if (res.data.code == 200) {
					_this.datas = res.data.data;
					_this.nums = _this.datas.coefficient_num;
				}
			});
			var userInfo = uni.getStorageSync('userInfo');
			_this.imgurl = userInfo.avatar;
			if(_this.imgurl == '') {
				_this.imgurl = this.defimg;
			}
			_this.name = userInfo.nicheng;

		},
		methods: {
			// black:function(){
			// if(this.from=='1'){
			// 	uni.navigateBack({
			// 		delta:1
			// 	});
			// }else{
			// 	uni.reLaunch({
			// 		url: '../index/index'
			// 	});
			// }
			// }
		},
		components: {
			uniRate
		}
	}
</script>

<style>
	.show_bg {
		background: #00D5A2;
	}
	.nav {
		z-index: 999;
		display: flex;
		flex-direction: row;
		position: fixed;
		width: 100%;
		height: 88upx;
		color: #FFFFFF;
		font-size: 36upx;
		padding-top: 40upx;
		line-height: 88upx;
		text-align: center;
		opacity: 1;
		background: #00D5A2;
	}

	.nav text {
		margin-left: 33%;
	}

	.funhui-css {
		margin-left: 20upx;
		line-height: 88upx;
		transform: rotate(180deg);
		font-size: 30upx;
	}

	* {
		margin: 0;
		padding: 0;
	}

	.content {
		position: absolute;
		width: 100%;
		height: 100%;
	}

	.head {
		background-size: 100% 100% ;
		width: 100%;
		height: 360upx;
	}

	.chu_bg {
		margin-top: 120upx;
		width: 100%;
		height: 128upx;
	}

	.group {
	
		position: relative;
		top: -174upx;
		left: 8%;
		width: 84%;
		min-height: 660upx;
		background: rgba(255, 255, 255, 1);
		box-shadow: 0px 6px 10px rgba(0, 172, 254, 0.1);
		opacity: 1;
		border-radius: 0px 0px 10px 10px;
		padding-bottom: 20upx;
	}

	.chu_yy {
		width: 100%;
		height: 44upx;
		line-height: 0upx !important;

	}

	.head_img {
		display: flex;
		justify-content: center;
	}

	.view_img {
		display: flex;
		justify-content: center;
	}

	.touxiang {
		width: 120upx;
		height: 120upx;
		margin-top: -20upx;
		border-radius: 50%;
	}

	.name {

		color: #333333;
		font-size: 32upx;
		font-weight: bold;
		text-align: center;


	}

	.xinxin {

		margin-top: 30upx;
		display: flex;
		justify-content: center;
	}

	.title {
		margin-top: 70upx;
		color: #000000;
		font-size: 36upx;
		font-weight: bold;
		display: flex;
		justify-content: center;
		line-height: 44upx;

	}

	.title text {
		margin: 0 20upx;
	}

	.title_img {
		width: 30upx;
		height: 15upx;
		margin-top: 18upx;
	}

	.group_text {
		margin: auto;
		margin-top: 30upx;
		width: 84.5%;
		color: #666666;
		font-size: 34upx;
	}

	.btn_ck {
		color: #FF9900;
		width: 36.9%;
		height: 66upx;
		line-height: 66upx;
		background:rgba(255,153,0,0.1);
		border-radius: 17px;
		text-align: center;
		font-size: 30upx;
		font-weight: 400;
		margin: 20upx auto;
	
	}

	.btn_cx {
		position: relative;
		top: -100upx;
		left: 8%;
		width: 84%;
		height: 80upx;
		background:rgba(255,153,0,1);
		opacity: 1;
		color: #fff;
		font-weight: bold;
		text-align: center;
		line-height: 80upx;
		font-size: 34upx;
	}

	.btn_sr {
		position: relative;
		top: -80upx;
		left: 8%;
		width: 84%;
		height: 80upx;
		background:rgba(0,213,162,1);
		opacity: 1;
		color: #fff;
		font-weight: bold;
		text-align: center;
		line-height: 80upx;
		margin-bottom: 40upx;
		font-size: 34upx;
	}
</style>
